package me.zxk.qwert_poetry.config;


import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SwaggerConfiguration {

    @Bean
    public OpenAPI customOpenAPI() {
        return new OpenAPI()
                .info(new Info().title("诗词网 API").version("1").description(""))
                .addSecurityItem(new SecurityRequirement().addList("oauth2"))
                .components(
                        new Components().addSecuritySchemes("oauth2",
                        new SecurityScheme().name("oauth2").type(SecurityScheme.Type.HTTP).scheme("bearer"))
                );
    }
}